// router/index.js
const userRouter = require('./user.js'); // 直接导入，无需解构
const bikeRouter = require('./bike.js');
const aiRouter = require('./ai.js');

const routerArr = [userRouter, bikeRouter, aiRouter]; // 确保数组中的对象是路由实例
  
  const useRouters = (app) => {
    routerArr.forEach(router => {
      app.use(
        router.routes(), // 路由中的回调会被触发
        router.allowedMethods()
      )
    })
  }
  
  module.exports = useRouters;